home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / test / pdl0.cc < prev    next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  104 lines

  1. #include "oath/pdlQueue.h"
  2.  
  3. #include "oath/character.h"
  4.  
  5. #include "oath/localToken.h"
  6.  
  7. #include <iostream.h>
  8.  
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #include "../src/ensure.cc"
  12.  
  13. #include "../src/typeRegisterP.cc"
  14.  
  15. #include "../src/exportP.cc"
  16.  
  17. #include "../src/oathCore.cc"
  18.  
  19. #include "../src/obj.cc"
  20.  
  21. #include "../src/token.cc"
  22.  
  23. #include "../src/localToken.cc"
  24.  
  25. #include "../src/character.cc"
  26.  
  27. #include "../src/bag.cc"
  28.  
  29. #include "../src/queue.cc"
  30.  
  31. #include "../src/seq.cc"
  32.  
  33. #include "../src/lifoQueue.cc"
  34.  
  35. #include "../src/slNodeP.cc"
  36.  
  37. #include "../src/pdlQueue.cc"
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Test of pdlQueues
  41.  
  42. main ()
  43.    {// Part One ////////////////////
  44.  
  45.     tokenA T = localTokenA::make();
  46.  
  47.     characterA A = characterA::make('A');
  48.     characterA B = characterA::make('B');
  49.     characterA C = characterA::make('C');
  50.     characterA D = characterA::make('D');
  51.  
  52.     cout << A << B << C << D << endl;
  53.  
  54.     pdlQueueA L1 = pdlQueueA::make() << A << B << C;
  55.     pdlQueueA L2 = pdlQueueA::make() << A << B << C;
  56.     pdlQueueA L3 = pdlQueueA::make(L2);
  57.  
  58.     if(L1.is(L2) || L1.is(L3))
  59.         cout << "is() failed!" << endl;
  60.     else
  61.         cout << "is() succeeded!" << endl;
  62.  
  63.     if(L1 == L2 && L1 == L3)
  64.         cout << "== succeeded!" << endl;
  65.     else
  66.         cout << "== failed!" << endl;
  67.  
  68.     if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
  69.         cout << "isEmpty() failed!" << endl;
  70.     else
  71.         cout << "isEmpty() succeeded!" << endl;
  72.  
  73.     if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
  74.         cout << "contains() succeeded!" << endl;
  75.     else
  76.         cout << "contains() failed!" << endl;
  77.  
  78.     cout << "There are " << L1.count() << " characters in L1: ";
  79.     posA P1 = L1.makePos();
  80.     while(P1())
  81.        {cout << characterA::isa(*P1);
  82.     ++P1;
  83.        }
  84.     cout << endl;
  85.  
  86.     cout << "The second character is " << characterA::isa(L1[1]) << endl;
  87.  
  88.     objA O;
  89.     L2 >> O;
  90.     cout << "The first character removed is " 
  91.      << characterA::isa(O) << endl;
  92.  
  93.     cout << "There are " << L2.count() << " characters in L2: ";
  94.     posA P2 = L2.makePos();
  95.     while(P2())
  96.        {cout << characterA::isa(*P2);
  97.         ++P2;
  98.        }
  99.     cout << endl;
  100.  
  101.    }
  102.  
  103.  
  104.